{% extends '_link.html' %}

{% block navbar %}

    <nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-primary">
        <a class="navbar-brand" href="/">Movie Review And Suggest</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
                aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item {% if request.path == '/' %} active {% endif %} ">
                    <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
                </li>

                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
                       aria-expanded="false">
                        Genres
                    </a>
                    <div class="dropdown-menu">
                        {% for genre_item in li_genres %}
                            <a class="dropdown-item"
                               href="/?genre_id={{ genre_item.id }}">{{ genre_item.value }}</a>
                        {% endfor %}
                    </div>
                </li>

                <li class="nav-item {% if request.path == '/favor' %} active {% endif %} ">
                    <a class="nav-link" href="/favor">My Favor </a>
                </li>
            </ul>


            <div style="display: flex">
                <form class="form-inline my-2 my-lg-0">
                    <input class="form-control mr-2" type="search" id="keyword" name="key" placeholder="Search"
                           aria-label="Search">
                    <button class="btn btn-light" type="submit">Search</button>
                </form>

                <div style="margin: 0 40px">
                    {% if session.user %}
                        <ul style="margin-bottom: 0px">
                            <li class="nav-item dropdown" style="list-style:none">
                                <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
                                   aria-expanded="false" style="color: white">
                                    {{ session.user.username }}
                                </a>
                                <div class="dropdown-menu">
                                    <a class="dropdown-item" href="/logout">Logout</a>
                                </div>
                            </li>
                        </ul>
                    {% else %}
                        <a href="/login" style="color:white;line-height: 40px">Go Login</a>
                    {% endif %}
                </div>

                {#                <ul class="nav navbar-nav navbar-right">#}
                {#                    <li><a href="/chat/">Chat Room</a></li>#}
                {##}
                {#                    <li class="dropdown">#}
                {#                        <a href="#" class="dropdown" data-toggle="dropdown"#}
                {#                           role="button" aria-haspopup="true"#}
                {#                           aria-expanded="false">ss <span class="caret"></span></a>#}
                {#                        <ul class="dropdown-menu">#}
                {#                            <li><a href="#">Action</a></li>#}
                {#                            <li><a href="#">Another action</a></li>#}
                {#                            <li><a href="#">Something else here</a></li>#}
                {#                            <li role="separator" class="divider"></li>#}
                {#                            <li><a href="/user/logout/">Logout</a></li>#}
                {#                        </ul>#}
                {#                    </li>#}
                {#                </ul>#}
            </div>

        </div>
    </nav>

{% endblock navbar %}
